package com.chs.recoginition.controller;


import com.chs.recoginition.pojo.Comments;
import com.chs.recoginition.service.ICommentsService;
import com.chs.recoginition.vo.PageRespVo;
import com.chs.recoginition.vo.Result;
import com.chs.recoginition.vo.reqvo.CommentPageVo;
import com.chs.recoginition.vo.reqvo.IdentificationPageVo;
import com.chs.recoginition.vo.respVo.CommentRespVo;
import com.chs.recoginition.vo.respVo.ImageRecognitionRespVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * <p>
 * 留言 前端控制器
 * </p>
 * @author CHS
 * @since 2023-04-08
 */
@RestController
@RequestMapping("/comments")
public class CommentsController extends BaseController{
    @Resource
    private ICommentsService commentsService;

    /**
     * 分页查询
     * @param reqVo
     * @return
     */
    @PostMapping("/findPage")
    Result<PageRespVo<CommentRespVo>> findPage(@RequestBody CommentPageVo reqVo) {
        return Result.success(commentsService.findPage(reqVo));
    }

    /**
     * 新增
     * @param reqVo
     * @return
     */
    @PostMapping("/save")
    Result<Void> save(@RequestBody Comments reqVo) {
        commentsService.save(reqVo,getUser());
        return Result.success();
    }

    /**
     * 修改
     * @param reqVo
     * @return
     */
    @PostMapping("/modify")
    Result<Void> modify(@RequestBody Comments reqVo) {
        commentsService.modify(reqVo,getUser());
        return Result.success();
    }

    /**
     * 删除
     * @param idList
     * @return
     */
    @PostMapping("/remove")
    Result<Void> remove(@RequestBody String idList) {
        commentsService.remove(idList);
        return Result.success();
    }

}
